package com.lywz.biz.dao.test.impl;

import java.util.Collection;
import java.util.List;

import org.hibernate.Query;
import org.springframework.stereotype.Repository;

import com.lywz.biz.common.dao.AbstractBaseDao;
import com.lywz.biz.common.entity.example.User;
import com.lywz.biz.dao.test.UserDao;
import com.lywz.core.util.CommonDefaultCheck;

@Repository("UserDao")
public class UserDaoImpl  extends AbstractBaseDao implements UserDao{
    @SuppressWarnings("unchecked")
    @Override
	public Collection<User> retrieveUserBy(String username) throws Exception{
		Query query = session().getNamedQuery("user.queryUser");
		query.setString("name", username);
		List<User> list = query.list();
		return (List<User>) CommonDefaultCheck.checkDefault(list);
	}
}
